/**
 * Created by Administrator on 2017/3/21.
 */
import React, {Component,Fragment} from 'react';
import {
  Form, Input, Radio, Select, Icon,
  Upload, Descriptions, DatePicker, Button, Modal, Tabs, InputNumber, message,Progress
} from 'antd';
import {connect} from 'dva';
import moment from 'moment'
import request from '@/utils/request';
import BuildModalTitle from "@/components/BuildModalTitle";
import {afterCloseModal, download} from "@/utils/utils";
import SelectUser from "@/pages/InnerAddressBook/SelectUser";
import findIndex from "lodash/findIndex";
import ReactDataGrid from "react-data-grid";
import ImportFile2 from "./ImportFile2";
import ImportFile22 from "./ImportFile22";
import filter from "lodash/filter";
import config from "@/config/config";
const { confirm } = Modal;
const {TabPane}=Tabs
const FormItem = Form.Item;
const {TextArea} = Input;
const RadioGroup = Radio.Group;
const Option = Select.Option;
let uuid = 10;
let uuid2 = 10;

class AddPoliciesForm extends Component {
  constructor(props) {
    super(props);
    this.state = {
      meterArr: [1, 2, 3, 4, 5, 6, 7, 8,9,10],
      meterArr2: [1, 2, 3, 4, 5, 6, 7, 8,9,10],
      fileList: [],
      all_department: [],
      selectUser: {
        username: this.props.editRecord ? this.props.editRecord.username : '',
        id: this.props.editRecord ? this.props.editRecord.user_id : '',
      },
      customJSON: this.props.editRecord.parameters,
      file_data:filter(this.props.editRecord.files,function (item){
        return ['地勘','规划','用地','审图','造价','招标信息','施工合同'].indexOf(item.type)>=0
      }),
      file_data2:filter(this.props.editRecord.files,function (item){
        return ['审计表','付款凭证'].indexOf(item.type)>=0
      }),

    };
  }


  componentDidMount() {
    const that=this
    if(this.props.editRecord.parameters.bill){
      const bill =this.props.editRecord.parameters.bill
      uuid=bill.length
      this.setState({
        meterArr:bill.map((item,index)=>{
          return index+1
        }),
      })
      for(let i=0;i<bill.length;i++){
        this.setState({
        },function() {
          that.props.form.setFieldsValue({
            [`name-${i+1}`]:bill[i].name,
            [`count-${i+1}`]:bill[i].count,
            [`price-${i+1}`]:bill[i].price,
            [`remark-${i+1}`]:bill[i].remark,
          })
        })
      }
    }
    if(this.props.editRecord.parameters.schedule){
      const schedule =this.props.editRecord.parameters.schedule
      uuid2=schedule.length
      this.setState({
        meterArr2:schedule.map((item,index)=>{
          return index+1
        }),
      })
      for(let i=0;i<schedule.length;i++){
        this.setState({
        },function() {
          that.props.form.setFieldsValue({
            [`schedule_number-${i+1}`]:schedule[i].schedule_number,
            [`schedule_task-${i+1}`]:schedule[i].schedule_task,
            [`schedule_hours-${i+1}`]:schedule[i].schedule_hours,
            [`schedule_menber-${i+1}`]:schedule[i].schedule_menber,
            [`schedule_start-${i+1}`]:moment(schedule[i].schedule_start),
            [`schedule_end-${i+1}`]:moment(schedule[i].schedule_end),
          })
        })
      }
    }
  }
  addMeter = () => {
    uuid++;
    this.state.meterArr.push(uuid);
    this.setState({
      [`meter${uuid}`]: [],
      meterArr: this.state.meterArr,
    });
  };
  addMeter2 = () => {
    uuid2++;
    this.state.meterArr2.push(uuid2);
    this.setState({
      // [`meter${uuid}`]: [],
      meterArr2: this.state.meterArr2,
    });
  };
  deleteMeter = (item) => {
    console.log('删除的item', item);
    if (this.state.meterArr.length === 1) {
      console.log('只有一个水表');
      // message.error('至少需要一个水表')
      // return false
    }
    const index = this.state.meterArr.indexOf(item);
    console.log('index', index);
    this.state.meterArr.splice(index, 1);
    this.setState({
      meterArr: this.state.meterArr,
    });
  };
  deleteMeter2 = (item) => {
    console.log('删除的item', item);
    if (this.state.meterArr2.length === 1) {
      console.log('只有一个水表');
      // message.error('至少需要一个水表')
      // return false
    }
    const index = this.state.meterArr2.indexOf(item);
    console.log('index', index);
    this.state.meterArr2.splice(index, 1);
    this.setState({
      meterArr2: this.state.meterArr2,
    });
  };
  handleChangeCustomJSON=(key,value)=>{
    console.log('value',value)
    this.setState({
      customJSON:{
        ...this.state.customJSON,
        [key]:value,

      }
    })
  }
  handleImport=()=>{
    const formValues =this.importFormRef.props.form.getFieldsValue();
    const that=this;
    console.log('formValues',formValues)
    if(!formValues.fileType){
      message.error('请选择类型')
      return  false
    }
    if(!formValues.file||formValues.file.fileList.length===0){
      message.error('请选择文件');
      return false
    }

    let formData = new FormData();
    formData.append("files[]", formValues.file.file);
    formData.append("fileType", '');
    request(`/project_files`, {
      method: 'POST',
      data: formData
    }).then((response)=> {
      console.log(response);
      if(response.status===200){
        that.state.file_data.push({
          ...response.data.data[0],
          type: formValues.fileType
        })
        that.setState({
          file_data:that.state.file_data,
          importModal:false
        })

      }
    })
  }
  handleImport2=()=>{
    const formValues =this.importFormRef2.props.form.getFieldsValue();
    const that=this;
    console.log('formValues',formValues)
    if(!formValues.fileType){
      message.error('请选择类型')
      return  false
    }
    if(!formValues.file||formValues.file.fileList.length===0){
      message.error('请选择文件');
      return false
    }

    let formData = new FormData();
    formData.append("files[]", formValues.file.file);
    formData.append("fileType", '');
    request(`/project_files`, {
      method: 'POST',
      data: formData
    }).then((response)=> {
      console.log(response);
      if(response.status===200){
        that.state.file_data2.push({
          ...response.data.data[0],
          type: formValues.fileType
        })
        that.setState({
          file_data2:that.state.file_data2,
          importModal2:false
        })

      }
    })
  }
  handleDelete=(key)=>{
    const fileINdex=findIndex(this.state.file_data,function (o){
      return o.key===key
    })
    this.state.file_data.splice(fileINdex,1)
    this.setState({
      file_data:this.state.file_data
    })
  }
  render() {
    const that=this
    const defaultColumnProperties = {
      resizable: true,
    };
    const {getFieldDecorator} = this.props.form;
    const columns1 = [
     {
        name: '文件类型',
        width: 100,
        key: 'type',
      },
      {
        name: '文件名称',
        width: 332,
        key: 'name',
      },
      {
        name: '文件大小',
        width: 200,
        key: 'size',
      },
      {
        name: '操作',
        width: 318,
        key: 'right',
        classname: 'operate',
        formatter: (event) => <Fragment>
          {
            <Button
              type="primary"
              size="small"
              onClick={()=>{
                download(`${config.prefix}/projects/${this.props.editRecord.id}/files/${event.row.key}/download?token=Bearer ${sessionStorage.getItem('token')}`);
              }}
            >下载
            </Button>
          }
          {
            !Boolean(this.props.type==='read')&&<Button
              type="danger"
              size="small"
              icon="delete"
              onClick={(e) => {
                confirm({
                  title: `确定要删除 ${event.row.name} 吗?`,
                  content: '请谨慎操作！',
                  okText: '确定',
                  okType: 'danger',
                  cancelText: '取消',
                  centered: true,
                  maskClosable: true,
                  onOk() {
                    that.handleDelete(event.row.key);
                  },
                  onCancel() {
                    console.log('Cancel');
                  },
                });
              }
              }
            >删除
            </Button>
          }

        </Fragment>,
      },

    ].map(c => ({ ...defaultColumnProperties, ...c }));
    const file_data=this.state.file_data;
    const file_data2=this.state.file_data2;
    const meterForms = this.state.meterArr.map((item, index) => {
      return (
        <Form style={{ display: 'flex' }} className={`custom-table-form custom-table-form${index}`} key={index} layout="inline">
          <div style={{ width: '50px', lineHeight: '29px', textAlign: 'center', border: '1px solid #d9d9d9' }}>
            {index + 1}
          </div>
          <FormItem
            style={{ flex: '1', marginRight: '0' }}
          >
            {getFieldDecorator(`name-${item}`, {
              initialValue: '',
            })(
              <Input className={'meter_number'} onPressEnter={(e) => {
                this.handleChange(e.target.value,`${item}`, index);
              }} style={{ width: '205px' }}  autoFocus={Boolean(index===0)} />
            )}
          </FormItem>
          <FormItem
            style={{ flex: '1', marginRight: '0' }}
          >
            {getFieldDecorator(`count-${item}`, {
              initialValue: '',
            })(
              <Input style={{ width: '205px' }} />,
            )}
          </FormItem>
          <FormItem
            style={{ flex: '1', marginRight: '0' }}

          >
            {getFieldDecorator(`price-${item}`, {
              initialValue: '',
            })(
              <Input style={{ width: '205px', fontWeight: 'bold' }}/>,
            )}
          </FormItem>
          <FormItem
            style={{ flex: '1', marginRight: '0' }}

          >
            {getFieldDecorator(`remark-${item}`, {
              initialValue: '',
            })(
              <Input style={{ width: '205px' }}/>,
            )}
          </FormItem>

          <div style={{ width: '80px', lineHeight: '29px', textAlign: 'center', border: '1px solid #d9d9d9' }}>
            { !Boolean(this.props.type==='read')&&<div
              style={{ padding: '0 4px',color:'#fff',cursor:'pointer',background:'#dc0000' }}
              onClick={(e) => {
                e.stopPropagation();
                this.deleteMeter(item);
              }
              }
            >删除
            </div>}
          </div>


        </Form>
      );
    });
    const meterForms2 = this.state.meterArr2.map((item, index) => {
      return (
        <Form style={{ display: 'flex' }} className={`custom-table-form custom-table-form${index}`} key={index} layout="inline">
          <div style={{ width: '50px', lineHeight: '29px', textAlign: 'center', border: '1px solid #d9d9d9' }}>
            {index + 1}
          </div>
          <FormItem
            style={{ flex: '1', marginRight: '0' }}
          >
            {getFieldDecorator(`schedule_number-${item}`, {
              initialValue: '',
            })(
              <Input className={'meter_number'} onPressEnter={(e) => {
                this.handleChange(e.target.value,`${item}`, index);
              }} style={{ width: '88px' }}   />
            )}
          </FormItem>
          <FormItem
            style={{ flex: '1', marginRight: '0' }}
          >
            {getFieldDecorator(`schedule_task-${item}`, {
              initialValue: '',
            })(
              <Input style={{ width: '187px' }} />,
            )}
          </FormItem>
          <FormItem
            style={{ flex: '1', marginRight: '0' }}

          >
            {getFieldDecorator(`schedule_start-${item}`, {
              initialValue: moment(),
            })(
              <DatePicker
                          allowClear={false} style={{ width: '137px' }}/>,
            )}
          </FormItem>
          <FormItem
            style={{ flex: '1', marginRight: '0' }}

          >
            {getFieldDecorator(`schedule_end-${item}`, {
              initialValue: moment(),
            })(
              <DatePicker
                allowClear={false} style={{ width: '137px' }}/>,
            )}
          </FormItem>
          <FormItem
            style={{ flex: '1', marginRight: '0' }}

          >
            {getFieldDecorator(`schedule_hours-${item}`, {
              initialValue: '',
            })(
              <Input style={{ width: '137px', fontWeight: 'bold' }}/>,
            )}
          </FormItem>
          <FormItem
            style={{ flex: '1', marginRight: '0' }}

          >
            {getFieldDecorator(`schedule_menber-${item}`, {
              initialValue: '',
            })(
              <Input style={{ width: '137px' }}/>,
            )}
          </FormItem>

          <div style={{ width: '80px', lineHeight: '29px', textAlign: 'center', border: '1px solid #d9d9d9' }}>
           <div
              style={{ padding: '0 4px',color:'#fff',cursor:'pointer',background:'#dc0000' }}
              onClick={(e) => {
                e.stopPropagation();
                this.deleteMeter2(item);
              }
              }
            >删除
            </div>
          </div>


        </Form>
      );
    });

    return (
      <div>
        <Form>
          <div style={{display:'inline-block',width:'48%',verticalAlign:'top'}}>
            <Descriptions column={8} className={'blue-descriptions'} title={''} bordered>
              <Descriptions.Item label="项目名称" span={8}>
                {this.props.editRecord.name}
              </Descriptions.Item>
              <Descriptions.Item label="当状进度" span={8}>
                {this.props.editRecord.payable_amount?
                  <Progress percent={(Number(this.props.editRecord.paid_amount)/Number(this.props.editRecord.payable_amount)*100).toFixed(2)} />
                :''}
              </Descriptions.Item>
            </Descriptions>
          </div>
          <div style={{display:'inline-block',width:'48%',marginLeft:'1%'}}>
          <Descriptions column={8} className={'blue-descriptions'} title={''} bordered>
            <Descriptions.Item label="财务状况" span={8}>
              <Descriptions column={8} className={'blue-descriptions'} title={''} bordered>
                <Descriptions.Item label="项目总价" span={8}>
                  {this.props.editRecord.payable_amount}
                </Descriptions.Item>
                <Descriptions.Item label="已收" span={8}>
                  {this.props.editRecord.paid_amount}
                </Descriptions.Item>
                <Descriptions.Item label="未收" span={8}>
                  {this.props.editRecord.payable_amount?Number(this.props.editRecord.payable_amount)-Number(this.props.editRecord.paid_amount):''}
                </Descriptions.Item>
              </Descriptions>
            </Descriptions.Item>
          </Descriptions>
          </div>


          <Tabs defaultActiveKey="0" >
            <TabPane tab="项目进度管理" key="0" forceRender={true}>
              <div style={{ border: '1px solid #d9d9d9', marginTop: '10px' }}>

                <div style={{
                  display: 'flex',
                  fontWeight: 'bold',
                  lineHeight: '32px',
                  height: '32px',
                  background: 'rgb(249,249,249)',
                }}>
                  <div style={{ width: '50px', paddingLeft: '10px', border: '1px solid #d9d9d9' }}>序号</div>
                  <div style={{ width: '88px', paddingLeft: '10px', border: '1px solid #d9d9d9' }}>任务编号</div>
                  <div style={{ width: '187px', paddingLeft: '10px', border: '1px solid #d9d9d9' }}>施工任务</div>
                  <div style={{ flex: '1', paddingLeft: '10px', border: '1px solid #d9d9d9' }}>开工时间</div>
                  <div style={{ flex: '1', paddingLeft: '10px', border: '1px solid #d9d9d9' }}>完工时间</div>
                  <div style={{ flex: '1', paddingLeft: '10px', border: '1px solid #d9d9d9' }}>工时</div>
                  <div style={{ flex: '1', paddingLeft: '10px', border: '1px solid #d9d9d9' }}>实施人员</div>
                  <div style={{ width: '80px', paddingLeft: '10px', border: '1px solid #d9d9d9' }}>操作</div>
                </div>
                {meterForms2}

                <Button type={'primary'} className={'btn-cyan'} icon={'plus'} block onClick={this.addMeter2}>添加行</Button>


              </div>
            </TabPane>
            <TabPane tab="立项审批表" key="1" forceRender={true}>
              <h3 style={{margin: '16px', textAlign: 'center', fontSize: '28px'}}>工程项目进度资金拨付审批表</h3>
              <Descriptions column={8} className={'blue-descriptions'} title={''} bordered>
                <Descriptions.Item label="项目名称" span={8}>
                  {getFieldDecorator('name', {
                    initialValue:this.props.editRecord.name,
                  })(
                    <Input disabled={Boolean(this.props.type==='read')} />
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="建设单位" span={8}>
                  {getFieldDecorator('jsdw', {
                    initialValue: this.state.customJSON.jsdw,
                  })(
                    <Input disabled={Boolean(this.props.type==='read')} onChange={(e)=>{
                      this.handleChangeCustomJSON('jsdw',e.target.value)
                    }}/>
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="开始时间" span={4}>
                  {getFieldDecorator('start_time', {
                    initialValue: this.props.editRecord.start_time?moment(this.props.editRecord.start_time):'',
                  })(
                    <DatePicker  disabled={Boolean(this.props.type==='read')}/>
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="结束时间" span={4}>
                  {getFieldDecorator('end_time', {
                    initialValue: this.props.editRecord.end_time?moment(this.props.editRecord.end_time):'',
                  })(
                    <DatePicker  disabled={Boolean(this.props.type==='read')}/>
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="建设规模" span={8}>
                  {getFieldDecorator('jsgm', {
                    initialValue: this.state.customJSON.jsgm,
                  })(
                    <Input disabled={Boolean(this.props.type==='read')} onChange={(e)=>{
                      this.handleChangeCustomJSON('jsgm',e.target.value)
                    }}/>
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="建设地点" span={5}>
                  {getFieldDecorator('jsdd', {
                    initialValue: this.state.customJSON.jsdd,
                  })(
                    <Input disabled={Boolean(this.props.type==='read')} onChange={(e)=>{
                      this.handleChangeCustomJSON('jsdd',e.target.value)
                    }}/>
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="工期" span={3}>
                  {getFieldDecorator('gq', {
                    initialValue: this.state.customJSON.gq,
                  })(
                    <Input disabled={Boolean(this.props.type==='read')} onChange={(e)=>{
                      this.handleChangeCustomJSON('gq',e.target.value)
                    }}/>
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="项目实施单位" span={5}>
                  {getFieldDecorator('xmssdw', {
                    initialValue: this.state.customJSON.xmssdw,
                  })(
                    <Input disabled={Boolean(this.props.type==='read')} onChange={(e)=>{
                      this.handleChangeCustomJSON('xmssdw',e.target.value)
                    }}/>
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="负责人" span={3}>
                  {getFieldDecorator('fzr', {
                    initialValue: this.state.customJSON.fzr,
                  })(
                    <Input disabled={Boolean(this.props.type==='read')} onChange={(e)=>{
                      this.handleChangeCustomJSON('fzr',e.target.value)
                    }}/>
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="项目实施单位服务类别" span={5}>
                  {getFieldDecorator('xmssdwlb', {
                    initialValue: this.state.customJSON.xmssdwlb,
                  })(
                    <Input disabled={Boolean(this.props.type==='read')} onChange={(e)=>{
                      this.handleChangeCustomJSON('xmssdwlb',e.target.value)
                    }}/>
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="联系电话" span={3}>
                  {getFieldDecorator('lxdh', {
                    initialValue: this.state.customJSON.lxdh,
                  })(
                    <Input disabled={Boolean(this.props.type==='read')} onChange={(e)=>{
                      this.handleChangeCustomJSON('lxdh',e.target.value)
                    }}/>
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="收款方名称" span={4}>
                  {getFieldDecorator('skfmc', {
                    initialValue: this.state.customJSON.skfmc,
                  })(
                    <Input disabled={Boolean(this.props.type==='read')} onChange={(e)=>{
                      this.handleChangeCustomJSON('skfmc',e.target.value)
                    }}/>
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="收款方账号" span={4}>
                  {getFieldDecorator('skfzh', {
                    initialValue: this.state.customJSON.skfzh,
                  })(
                    <Input disabled={Boolean(this.props.type==='read')} onChange={(e)=>{
                      this.handleChangeCustomJSON('skfzh',e.target.value)
                    }}/>
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="合同价/审计价" span={4}>
                  {getFieldDecorator('htj', {
                    initialValue: this.state.customJSON.htj,
                  })(
                    <InputNumber disabled={Boolean(this.props.type==='read')} style={{width:'100%'}} onChange={(e)=>{
                      this.handleChangeCustomJSON('htj',e)
                    }}/>
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="应付金额" span={4}>
                  {getFieldDecorator('payable_amount', {
                    initialValue: this.props.editRecord.payable_amount,
                  })(
                    <InputNumber disabled={Boolean(this.props.type==='read')} style={{width:'100%'}} />
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="已付款" span={4}>
                  {getFieldDecorator('paid_amount', {
                    initialValue: this.props.editRecord.paid_amount,
                  })(
                    <InputNumber disabled={Boolean(this.props.type==='read')} style={{width:'100%'}} />
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="未付款" span={4}>
                  {getFieldDecorator('wfk', {
                    initialValue: this.state.customJSON.wfk,
                  })(
                    <InputNumber disabled={Boolean(this.props.type==='read')} style={{width:'100%'}} onChange={(e)=>{
                      this.handleChangeCustomJSON('wfk',e)
                    }}/>
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="形象进度及现场甲方代表意见" span={8}>
                  {getFieldDecorator('jfdbyj', {
                    initialValue: this.state.customJSON.jfdbyj,
                  })(
                    <TextArea disabled={Boolean(this.props.type==='read')} onChange={(e)=>{
                      this.handleChangeCustomJSON('jfdbyj',e.target.value)
                    }} rows={4} />
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="项目分管领导意见" span={8}>
                  {getFieldDecorator('xmfgldyj', {
                    initialValue: this.state.customJSON.xmfgldyj,
                  })(
                    <TextArea disabled={Boolean(this.props.type==='read')} onChange={(e)=>{
                      this.handleChangeCustomJSON('xmfgldyj',e.target.value)
                    }} rows={2} />
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="财务分管领导意见" span={8}>
                  {getFieldDecorator('cwfgldyj', {
                    initialValue: this.state.customJSON.cwfgldyj,
                  })(
                    <TextArea disabled={Boolean(this.props.type==='read')} onChange={(e)=>{
                      this.handleChangeCustomJSON('cwfgldyj',e.target.value)
                    }} rows={2} />
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="总经理意见" span={8}>
                  {getFieldDecorator('zjlyj', {
                    initialValue: this.state.customJSON.zjlyj,
                  })(
                    <TextArea disabled={Boolean(this.props.type==='read')} onChange={(e)=>{
                      this.handleChangeCustomJSON('zjlyj',e.target.value)
                    }} rows={2} />
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="党 支部 书 记 意 见" span={8}>
                  {getFieldDecorator('dzbsjyj', {
                    initialValue: this.state.customJSON.dzbsjyj,
                  })(
                    <TextArea disabled={Boolean(this.props.type==='read')} onChange={(e)=>{
                      this.handleChangeCustomJSON('dzbsjyj',e.target.value)
                    }} rows={2} />
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="备注" span={8}>
                  {getFieldDecorator('bz', {
                    initialValue: (this.state.customJSON.bz) ? this.state.customJSON.bz : '项目实施单位服务类别包括:环评、可研、测绘、测量、地勘、设计、造价、招标代理、施工、监理、审计，其他',
                  })(
                    <TextArea disabled={Boolean(this.props.type==='read')} onChange={(e)=>{
                      this.handleChangeCustomJSON('bz',e.target.value)
                    }} rows={2} />
                  )}
                </Descriptions.Item>
              </Descriptions>
            </TabPane>
            <TabPane tab="申请表" key="12" forceRender={true}>
              <Descriptions  column={4}   className={'blue-descriptions'} title={''} bordered>
                <Descriptions.Item span={4} label="申请人">
                  {this.props.editRecord.applicant.name}
                </Descriptions.Item>
                <Descriptions.Item label="立项原因"  span={4}>
                  {this.props.editRecord.parameters.lxyy}
                </Descriptions.Item>
                <Descriptions.Item label="需求说明"  span={4}>
                  {this.props.editRecord.parameters.xqsm}
                </Descriptions.Item>

              </Descriptions>
            </TabPane>
            <TabPane tab="可研文件" key="2" forceRender={true}>
              {
                !Boolean(this.props.type==='read')&&<Button type={'primary'} block style={{marginBottom:'16px'}} onClick={()=>{
                  this.setState({
                    importModal:true
                  })
                }}>上传文件</Button>
              }
              <ReactDataGrid
                columns={columns1}
                rowGetter={i => {
                  return { ...file_data[i], _index: i };
                }}
                rowsCount={file_data.length}
                minHeight={281}

              />
            </TabPane>
            <TabPane tab="材料清单" key="3" forceRender={true}>
              <div style={{ border: '1px solid #d9d9d9', marginTop: '10px' }}>

                <div style={{
                  display: 'flex',
                  fontWeight: 'bold',
                  lineHeight: '32px',
                  height: '32px',
                  background: 'rgb(249,249,249)',
                }}>
                  <div style={{ width: '50px', paddingLeft: '10px', border: '1px solid #d9d9d9' }}>序号</div>
                  <div style={{ flex: '1', paddingLeft: '10px', border: '1px solid #d9d9d9' }}>物料名称</div>
                  <div style={{ flex: '1', paddingLeft: '10px', border: '1px solid #d9d9d9' }}>数量</div>
                  <div style={{ flex: '1', paddingLeft: '10px', border: '1px solid #d9d9d9' }}>价格</div>
                  <div style={{ flex: '1', paddingLeft: '10px', border: '1px solid #d9d9d9' }}>备注</div>
                  <div style={{ width: '80px', paddingLeft: '10px', border: '1px solid #d9d9d9' }}>操作</div>
                </div>
                {meterForms}

                {
                  !Boolean(this.props.type==='read')&& <Button type={'primary'} className={'btn-cyan'} icon={'plus'} block onClick={this.addMeter}>添加行</Button>
                }

              </div>

            </TabPane>
            <TabPane tab="验收资料" key="4" forceRender={true}>
              {
                !Boolean(this.props.type==='read')&&<Button type={'primary'} block style={{marginBottom:'16px'}} onClick={()=>{
                  this.setState({
                    importModal2:true
                  })
                }}>上传文件</Button>
              }
              <ReactDataGrid
                columns={columns1}
                rowGetter={i => {
                  return { ...file_data2[i], _index: i };
                }}
                rowsCount={file_data2.length}
                minHeight={281}

              />
            </TabPane>
          </Tabs>
        </Form>
        <Modal
          title={<BuildModalTitle visible={this.state.selectModal} modalClass="selectModal"
                                  title={`选择申请人`}/>}
          destroyOnClose
          visible={this.state.selectModal}
          centered
          width={900}
          onOk={this.handleChangeStatus}
          className="selectModal"
          afterClose={() => {
            afterCloseModal(); // destroyOnClose需要
          }}
          onCancel={() => {
            this.setState({selectModal: false});
          }}
        >
          <SelectUser refleshDepartments={this.SelectUser} username={this.state.username} selectUser={(row) => {
            this.setState({
              selectModal: false,
              selectUser: row
            })
          }}
          />

        </Modal>
        <Modal
          title={<BuildModalTitle visible={this.state.importModal} modalClass="importModal" title="上传可研文件"/>}
          visible={this.state.importModal}
          centered
          onOk={this.handleImport}
          className="importModal"
          onCancel={() => {
            this.setState({ importModal: false });
          }}

        >
          <ImportFile2 fileType={this.state.fileType} wrappedComponentRef={(inst) => this.importFormRef = inst}/>
        </Modal>
        <Modal
          title={<BuildModalTitle visible={this.state.importModal2} modalClass="importModal2" title="上传验收资料"/>}
          visible={this.state.importModal2}
          centered
          onOk={this.handleImport2}
          className="importModal2"
          onCancel={() => {
            this.setState({ importModal2: false });
          }}

        >
          <ImportFile22 fileType={this.state.fileType} wrappedComponentRef={(inst) => this.importFormRef2 = inst}/>
        </Modal>
      </div>
    );
  }
}

const AddPoliciesFormWrap = Form.create()(AddPoliciesForm);
export default connect()(AddPoliciesFormWrap);
